import request from '@/utils/request'

/**
 * 请求登录接口
 * @param {*} loginForm 登录接口需要的用户名和密码
 * @returns
 */
export const loginApi = loginForm => {
  return request({
    method: 'post',
    url: '/sys/login',
    data: loginForm
  })
}

/**
 * 获取用户的基本信息
 * @returns
 */
export const getProfileApi = () => {
  return request({
    url: '/sys/profile',
    method: 'post'
  })
}

/**
 * 获取用户的信息
 * @param {*} id 用户ID
 * @returns
 */
export const getUserInfoApi = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'get'
  })
}

export const getUserSimpleAPi = () => {
  return request({
    url: '/sys/user/simple',
    method: 'GET'
  })
}
/**
 *
 * @param {*} id
 * @returns 删除员工
 */
export function reqDelEmployeeAPI(id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}
/**
 *
 * @param {*} data 提交的表单
 * @returns  新增员工
 */
export function addEmployeeAPI(data) {
  return request({
    method: 'POST',
    url: '/sys/user',
    data
  })
}

/**
 *
 * @param {*} data
 * @returns  批量导入员工
 */
export function reqImportEmployeeAPI(data) {
  return request({
    method: 'POST',
    url: '/sys/user/batch',
    data
  })
}
/**
 *
 * @param {*} data
 * @returns 给员工分配角色
 */
export function assignRolesAPI(data) {
  return request({
    method: 'put',
    url: '/sys/user/assignRoles',
    data
  })
}
